package com.cg.utils.model;

import java.util.ArrayList;
import java.util.List;

import com.alibaba.fastjson.JSON;
import com.cg.entity.MapBuilding;
import com.cg.entity.UserInfoBuildingsVo;

public class MapBuildingsUtils {

	public static List<UserInfoBuildingsVo> calcFloorsByMapBuilding(MapBuilding mapBuilding){		
		List<UserInfoBuildingsVo> rs= new ArrayList<UserInfoBuildingsVo>();
		for(int i=1;i<=mapBuilding.getFloors();i++) {
			for(int j=1 ;j<=mapBuilding.getRooms();j++) {
				UserInfoBuildingsVo vos = new UserInfoBuildingsVo();
				vos.setFloor(i);
				vos.setBuildingId(mapBuilding.getId());
				vos.setBuildingAdress(""+i+"-"+j);
				rs.add(vos);
			}
		}
		return rs;
	}
	
	public static void main(String[] args) {
		MapBuilding buildings = new MapBuilding();
		buildings.setId(1);
		buildings.setFloors(10);
		buildings.setRooms(6);
		System.out.println(JSON.toJSONString(calcFloorsByMapBuilding(buildings)));
	}
}
